<?php
/**
 * Created by PhpStorm.
 * User: 王新宇
 * Date: 2021/11/23
 * Time: 19:31
 */

namespace app\admin\model;


use think\Model;

class Brand extends Model
{
    //搜索器
    public function searchKeywordsAttr($q,$v)
    {
        $q->where('brand_name','like',"%{$v}%");
    }
    public function searchRecommendedAttr($q,$v)
    {
        $q->where('recommended','=',$v);
    }
    public function searchIfShowAttr($q,$v)
    {
        $q->where('if_show','in',$v);
    }
    public static function getBrandList($where){
      return $list= Brand::
      withSearch(array_keys($where),$where)
        ->paginate([
          'list_rows'=>4,
          'query'=>$where
      ]);
    }
}